﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsGame1
{
    public partial class Formtest : Form
    {
        private bool InsertTerrain = false;
        private bool _Full3DIso = false;
        public bool Full3DIso
        {
            get { return _Full3DIso; }
            set { _Full3DIso = value; }
        }
        private bool InsertEtre = false;
        private Image _ImageTerrain;
        public Image ImageTerrain
        {
            get { return _ImageTerrain; }
            set { _ImageTerrain = value; }
        }
        private Image _ImageEtre;
        public Image ImageEtre
        {
            get { return _ImageEtre; }
            set { _ImageEtre = value; }
        }
        private string _nomEtre;
        public string nomEtre
        {
            get { return _nomEtre; }
            set { _nomEtre = value; }
        }
        private List<EtreVivant> _listLoup;

        public List<EtreVivant> listLoup
        {
            get { return _listLoup; }
            set { _listLoup = value; }
        }
        private List<EtreVivant> _listChevre;

        public List<EtreVivant> listChevre
        {
            get { return _listChevre; }
            set { _listChevre = value; }
        }

        private int _num;
        public int num
        {
            get { return _num; }
            set { _num = value; }
        }
        public Formtest()
        {
            InitializeComponent();
        }

        private void Formtest_Load(object sender, EventArgs e)
        {
            Image im = Image.FromFile(Application.StartupPath + @"\Content\mer.jpg");
            Bitmap img = new Bitmap(im,new System.Drawing.Size(PbMer.Width,PbMer.Height));
            PbMer.BackgroundImage = img;
            im = Image.FromFile(Application.StartupPath + @"\Content\Foret.jpg");
            img = new Bitmap(im, new System.Drawing.Size(PbForet.Width, PbForet.Height));
            PbForet.BackgroundImage = img;
            im = Image.FromFile(Application.StartupPath + @"\Content\Plaine.jpg");
            img = new Bitmap(im, new System.Drawing.Size(PbPlaine.Width, PbPlaine.Height));
            PbPlaine.BackgroundImage = img;
            im = Image.FromFile(Application.StartupPath + @"\Content\Montagne.jpg");
            img = new Bitmap(im, new System.Drawing.Size(PbMontagne.Width, PbMontagne.Height));
            PbMontagne.BackgroundImage = img;
            im = Image.FromFile(Application.StartupPath + @"\Content\Desert.jpg");
            img = new Bitmap(im, new System.Drawing.Size(PbDesert.Width, PbDesert.Height));
            PbDesert.BackgroundImage = img;
            im = Image.FromFile(Application.StartupPath + @"\Content\Loup.png");
            img = new Bitmap(im, new System.Drawing.Size(pbLoup.Width, pbLoup.Height));
            pbLoup.BackgroundImage = img;
            im = Image.FromFile(Application.StartupPath + @"\Content\Chevre.png");
            img = new Bitmap(im, new System.Drawing.Size(pbChevre.Width, pbChevre.Height));
            pbChevre.BackgroundImage = img;
            listLoup = new List<EtreVivant>();
            listChevre = new List<EtreVivant>();
            
            
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (!_Full3DIso)
            {
                InsertTerrain = checkBox1.Checked;
                cbEtre.Checked = false;
                if (!InsertTerrain)
                    ImageTerrain = null;
            }
            else
            {
                checkBox1.Checked = false;
                InsertTerrain = false;
            }
        }

        private void PbMer_Click(object sender, EventArgs e)
        {
            if (InsertTerrain)
                ImageTerrain = Image.FromFile(Application.StartupPath + @"\Content\mer.jpg"); ;
        }

        private void PbForet_Click(object sender, EventArgs e)
        {
            if (InsertTerrain)
                ImageTerrain = Image.FromFile(Application.StartupPath + @"\Content\Foret.jpg");
        }

        private void PbPlaine_Click(object sender, EventArgs e)
        {
            if (InsertTerrain)
                ImageTerrain = Image.FromFile(Application.StartupPath + @"\Content\Plaine.jpg");
        }

        private void PbMontagne_Click(object sender, EventArgs e)
        {
            if (InsertTerrain)
                ImageTerrain = Image.FromFile(Application.StartupPath + @"\Content\Montagne.jpg");
        }

        private void PbDesert_Click(object sender, EventArgs e)
        {
            if (InsertTerrain)
                ImageTerrain = Image.FromFile(Application.StartupPath + @"\Content\Desert.jpg");
        }

        private void CbIso_CheckedChanged(object sender, EventArgs e)
        {
            _Full3DIso = CbIso.Checked;
            if (_ImageTerrain != null)
            {
                _ImageTerrain = null;       
            }
            if (_ImageEtre != null)
            {
                _ImageEtre = null;    
            }
            checkBox1.Checked = false;
            cbEtre.Checked = false;
        }

        private void cbEtre_CheckedChanged(object sender, EventArgs e)
        {
            if (!_Full3DIso)
            {
                InsertEtre = cbEtre.Checked;
                checkBox1.Checked = false;
                if (!InsertEtre)
                    ImageEtre = null;
            }
            else
            {
                InsertEtre = false;
                cbEtre.Checked = false;
            }
        }

        private void pbLoup_Click(object sender, EventArgs e)
        {
            if (InsertEtre)
            {
                ImageEtre = Image.FromFile(Application.StartupPath + @"\Content\Loup.png");
                nomEtre = "loup";
                _num = 0;
            }
        }

        private void pbChevre_Click(object sender, EventArgs e)
        {
            if (InsertEtre)
            {
                ImageEtre = Image.FromFile(Application.StartupPath + @"\Content\Chevre.png");
                nomEtre = "Chevre";
                _num = 1;
            }
        }

    }
}
